package com.ycw.servlet.wangwang;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.ycw.dao.ContractDao;
import com.ycw.dao.impl.ContractDaoImpl;

@WebServlet("/doSearchServlet")
public class doSearchServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		ContractDao cd = new ContractDaoImpl();
		String c_signer = request.getParameter("c_signer");
		String c_count = request.getParameter("c_count");
		String c_state = request.getParameter("c_state");
		String pageIndexCon = request.getParameter("page");

		int page = Integer.parseInt(pageIndexCon);

		Map<String, Object> map = cd.contractSelect(c_signer, c_state, c_count, page);

		// 向前端发送JSON数据
		String resJSON = JSON.toJSONString(map);
		PrintWriter out = response.getWriter();
		out.write(resJSON);
		out.close();
	}

}
